package com.sy.service.impl;

import com.sy.dao.UserInfoDao;
import com.sy.entity.UserInfo;
import com.sy.service.intf.UserInfoService;
import com.sy.vo.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


/**
 * @description: 码起 自动生成代码
 * @author: 小毛
 * @create: 2020-11-25 22:00:26
 */
@Service
public class UserInfoServiceImpl implements UserInfoService {

    @Autowired
    private UserInfoDao userInfoDao;

    @Override
    public R save(UserInfo userInfo){
        if(userInfoDao.insert(userInfo)>0){
            return R.ok();
        }else{
            return R.fail("新增失败");
        }
    }
    @Override
    public R delById(int id){
        if(userInfoDao.deleteById(id)>0){
            return R.ok();
        }else{
            return R.fail("删除失败");
        }
    }
    @Override
    public R all(){
       return R.ok(userInfoDao.all());
    }
}
